#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 21 14:28:23 2015

@author: azzollini
"""

from pdb import set_trace as stop
from pySkySim.basicsources import Extended
from pySkySim import radial as rad

class Disk(Extended):
    """ """
    
    def __init__(self,Cen=(0.,0.),q=1.,pa=0.,c=0.):
        """ """
        
        super(Disk,self).__init__()
        
        self.Cen = Cen
        self.q = q
        self.pa = pa
        self.c = c
        
    def __str__(self):
        """ """
        verbose = '\n'
        manifesto_dsk = 'Pos=%.1f,%.1f,\nq=%.1f\npa=%.1f\nc=%.1f\n'
        
        verbose += (manifesto_dsk % \
         (self.Cen+(self.q,self.pa,self.c)))
         
        verbose += super(Disk,self).__str__()
        return verbose


    def spatial(self,Pos):
        """ """
        radii = self.radial(Pos)
        NIM = self.radprof(radii)
        return NIM
    
    
    def radial(self,Pos):
        """ """
        return rad.dist_mask(Pos,self.Cen,self.pa,self.q,self.c)
        

        

class ExpDisk(Disk):
    """ """
    
    def __init__(self,h,**kwargs):
        """ """
        super(ExpDisk,self).__init__(**kwargs)
        
        self.h = h
        self.i_0 = 1.
        

    def __str__(self):
        """ """
        verbose = '\n\nI am an Exponential Disk\n'
        
        manifesto_expdsk = 'Disk scale = %.2f'
        verbose += manifesto_expdsk % (self.h,)
        
        verbose += super(ExpDisk,self).__str__()
        return verbose

    def radprof(self,r):
        return rad.fexp(r,self.i_0,self.h)
    

class SersicDisk(Disk):
    """ """
    
    def __init__(self,n,re,**kwargs):
        """ """
        super(SersicDisk,self).__init__(**kwargs)
        
        self.n = n
        self.re = re
        
        self.ie = lib.return0() # done through a function
    
    def __str__(self):
        """ """
        verbose = '\n\nI am a "Sersic Disk"\n'
        
        manifesto_sersic = 'Sersic Index = %.2f\n'+\
        'Scale radius = %.2f\n'
        verbose += manifesto_sersic % (self.n,self.re,)
        
        verbose += super(SersicDisk,self).__str__()
        return verbose


    def radprof(self,r):
        return rad.fsersic(r,self.n,self.re)

class PowLawDisk():
    """ """
    pass
    


class KepDisk(Disk):
    """ """
    
    def __init__(self):
        """ """

    def __str__(self):
        """ """
        print('I am a Keplerian Disk')
        manifesto_kepdsk = 'Keplerian Parameter = %.2f'
        print(manifesto_kepdsk % (0,))

        super(KepDisk,self).__str__()
    
    